<?php
try {
	$con =new PDO("mysql:host=mysql5.7;dbname=test","root","root");
	echo "PDO扩展 连接成功 <br/>";

    $con->exec("INSERT INTO `test`(`time`, `name`) VALUES ('".date('Y-m-d H:i:s')."', '测试PDO插入')");
    echo "PDO扩展 数据插入成功 <br/>";

    $stmt = $con->query('select * from `test` order by id desc limit 1');
    $rows = $stmt->fetch(); //获取所有
    echo "<pre>";
    var_dump($rows);
    echo "</pre>";
} catch (PDOException $e) {
	echo $e->getMessage();
}


$con = new mysqli("mysql5.7","root","root");

if ($con->connect_error) {
	die("mysqli扩展 连接失败 ".$con->connect_error);
} else {
	echo "mysqli扩展 连接成功 <br/>";
}